package hfxy.dzx.u21ex;

import java.io.InputStream;
import java.util.List;

import junit.framework.TestCase;

public class ParseTest2 extends TestCase {
	public void testDom() throws Exception {
		InputStream input = this.getClass().getResourceAsStream("book.xml");
		DomParseService dom = new DomParseService();
		List<Book> books = dom.getBooks(input);
		for (Book book : books) {
			System.out.println(book.toString());
		}
	}
	
	public void testSAX() throws Throwable{
		SaxParseService sax = new SaxParseService();
		InputStream input = this.getClass().getResourceAsStream("book.xml");
		List<Book> books = sax.getBooks(input);
		for(Book book : books){
			System.out.println(book.toString());
		}
	}

}
